const cheerio=require('cheerio');
const urllib = require('url');
const fs = require("fs");
const get = require("./libs/request.js");

(async ()=>{
	let {body} = await get("http://www.baidu.com/img/baidu_jgylogo3.gif");
	console.log(body)
	/*let $ = cheerio.load(body)
	$("img").each(async function(){
		let url =$(this).attr("src");
		let {host,path} = urllib.parse(url);
		let name = path.substring(path.lastIndexOf("/")+1);
		console.log(url)
		let {body} = await get(url);
		fs.writeFile("img/"+name, body,null,err=>{
			console.log(err)
		})
	})*/
})();

